fix: use os.homedir() for models cache path on Windows - #886
Open
tusharui wants to merge 3 commits into
Open
Conversation
process.env.HOME is undefined on Windows, causing path.join('~', '.cache')
to create a literal ~ directory. Use os.homedir() which resolves correctly
on all platforms.
tusharui
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
August 17, 2026 11:35
Collaborator
|
@tusharui Thanks for the fix! One small process request for future contributions: please create an issue first for any new bugs/features, then ask to be assigned before starting the implementation. This helps us keep ownership and scope clear. For the additional issues you found here, please open separate issues for them first, and then feel free to pick them up once assigned:
For this PR, please add the Windows-specific regression test mentioned above and rerun the tests. Everything else looks good! |
…ests - Fix scripts/fetch-models.js to use os.homedir() instead of process.env.HOME || '~' which produces a literal ~ directory on Windows - Add regression tests that verify the old pattern produces a literal ~ while os.homedir() resolves the real home directory
akramcodez
approved these changes
Aug 21, 2026
akramcodez
left a comment
Collaborator
There was a problem hiding this comment.
Crazy work @tusharui, LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
process.env.HOMEis undefined. The models cache fallback path usesprocess.env.HOME || '~', which resolves to the literal string~/.cache— not the user's actual home directory. This causes:~folder created in the current working directoryFix
Replace
process.env.HOME || '~'withos.homedir()insource/models/models-cache.ts.os.homedir()returns the correct home directory on all platforms:C:\Users\username/Users/username/home/usernameTesting
All 9 existing tests in
models-cache.spec.tspass.